using Caliburn.Micro;
using MediaOwl.Common.Busy;
using MediaOwl.Common.Dialog;
using MediaOwl.Common.ScreenManagement;
using MediaOwl.Common.ViewModels;

namespace MediaOwl.Common
{
    /// <summary>
    /// A Shortcut-Class that creates <see cref="OpenChildResult&lt;TChild&gt;"/>
    /// </summary>
    /// <remarks>This class is a part of the Show-Class of the Caliburn Framework</remarks>
    public static class Show
    {

        public static OpenChildResult<TChild> Child<TChild>(string screenId = null) 
            where TChild : class
        {
            return new OpenChildResult<TChild>(screenId);
        }

        public static OpenChildResult<TChild> Child<TChild>(TChild child, string screenId = null) 
            where TChild : class
        {
            return new OpenChildResult<TChild>(child, screenId);
        }

        public static ShowBusy Busy(IBusyCapable busyViewModel)
        {
            return new ShowBusy(busyViewModel);
        }

        public static ShowBusy Busy(IBusyCapable busyViewModel, double targetValue)
        {
            return new ShowBusy(busyViewModel, targetValue);
        }

        public static ShowBusy NotBusy(IBusyCapable busyViewModel)
        {
            return new ShowBusy(busyViewModel, true);
        }

        public static ShowDialog<TDialog> Dialog<TDialog>()
            where TDialog : class, IDialog
        {
            return new ShowDialog<TDialog>();
        }

        public static ShowDialog<TDialog> Dialog<TDialog>(TDialog dialog)
            where TDialog : class, IDialog
        {
            return new ShowDialog<TDialog>(dialog);
        }

        public static ShowDialog<DialogMessageViewModel> MessageBox(string message, string title = null, DialogType type = DialogType.OkOnly)
        {
            var messageBox = IoC.Get<DialogMessageViewModel>();

            messageBox.WithData(message, title, type);
            return new ShowDialog<DialogMessageViewModel>(messageBox);
        }
    }
}